package com.easyfun.healthmagicbox.comm;

import java.util.HashMap;
import java.util.Map;

import org.json.JSONObject;

import android.content.Context;
import com.easyfun.healthmagicbox.ormlite.ServerResponseCode;
import com.easyfun.healthmagicbox.pojo.ConstantData;
import com.easyfun.healthmagicbox.sync.CommCallback;

public class RemovePersonProfileTask extends BaseCommTask implements Runnable{

	String username;
	String personID;
	
	public RemovePersonProfileTask(String username, String personID,
			Context mcontext, CommCallback ccb) {
		super(mcontext, ccb);
		this.username = username;
		this.personID = personID;
	}

	@Override
	public void run() {
		JSONObject serializedObj = new JSONObject();
		String result = "";
		try {
			serializedObj.put("personID", personID);
			serializedObj.put("username", username);			

			Map<String, String> parmas = new HashMap<String, String>();
			parmas.put("jsonstring", serializedObj.toString());
			result = super.uploadByHTTP(parmas, ConstantData.PersonProfileRemoveURI);
			if (ServerResponseCode.parseOf(result) == ServerResponseCode.FAILED) {
				ccb.setCommResult(this, result,
						ServerResponseCode.FAILED);
			}else
			{
				ccb.setCommResult(this, result,
						ServerResponseCode.SUCCESS);
			}
		} catch (Exception e) {
			e.printStackTrace();
			ccb.setCommResult(this, result,
					ServerResponseCode.FAILED);
		}
		
	}

}
